@extends('layout.default')

@section('layout.content')

  <div class="row">
    <div class="col-xs-12">
      <div class="borrow-list">        
        <a href="{{route('book.edit',array('id'=>$book->id) )}}">
          <img class="lazy pull-left img-error1" src="/assets/images/blank.gif" data-original="/assets/images/books/{{$book->dbid}}.jpg" />
        </a>
        <div class="borrow-title"><span class="smaller-80">{!! $book->present()->bookStore !!}</span> <a href="javascript:;">{{ $book->title }}</a></div>
        <div class="borrow-author smaller-80">ISBN：{{ $book->isbn }}</div>
        <div class="borrow-author smaller-80">作者：{{ $book->author }}</div>
        <div class="borrow-author smaller-80">出版社：{{ $book->publisher }}</div>
        <div class="borrow-summary smaller-80 grey">{{ $book->summary }}</div>          
      </div>
      
      <div class="reader-list">
        <h6 class="header smaller lighter green">借阅记录</h6>
        <table id="book_list" class="table table-hover table-striped table-bordered nonborder">
          <thead>
          <tr>
            <th class="center">帐号</th>
            <th class="align-middle">姓名</th>
            <th class="center">借阅</th>
            <th class="center">还书</th>
            <th class="center">借阅日期</th>
            <th class="center">归还日期</th>
            <th class="center hidden-480">状态</th>
          </tr>
          </thead>

          <tbody>
          @foreach ($book->borrows as $borrow)
            <tr>
              <td class="center smaller-80"><a
                    href="{{route('user.edit',array('uid'=>$borrow->user->id))}}">{{ $borrow->user->account }}</a>
              </td>
              <td class="align-middle">{!! $borrow->user->present()->face !!}<a
                    href="{{route('user.view',array('uid'=>$borrow->user->id))}}" class="uid"
                    data-id="{{ $borrow->user->id }}">{{ $borrow->user->name }}</a></td>
              <td class="center b-borrow">{{ $borrow->user->summary->borrows }}</td>
              <td class="center b-return">{{ $borrow->user->summary->returns }}</td>
              <td class="center smaller-80 grey">{{ date('Y-m-d',$borrow->date_begin) }}</td>
              <td class="center smaller-80 grey">{{ is_null($borrow->date_return)?'':date('Y-m-d',$borrow->date_return) }}</td>
              <td class="center hidden-480">{!! $borrow->present()->BorrowStatus !!}</td>
              
            </tr>
          @endforeach

          </tbody>
        </table>

      </div><!-- /.col -->

    </div>
  </div>

@stop

@section('javascript')
  <script src="//cdn.bootcss.com/jquery_lazyload/1.9.7/jquery.lazyload.min.js"></script>
  <script type="text/javascript">

    $(function () {
      
      $(".lazy").lazyload({
        effect : "fadeIn"
      });

    });
  </script>
@stop